 package com.gmrz.uaf.crypto;
 
 import java.util.Properties;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.google.inject.name.Names;
import com.gmrz.uaf.common.UAFBaseModule;
import com.gmrz.uaf.common.UAFRuntimeException;
import com.gmrz.uaf.protocol.v1.json.CertificateAdapter;
import com.gmrz.uaf.protocol.v1.json.ServerDataAdapter;
 
 public class UAFCryptoModule extends UAFBaseModule
 {
   private static final Logger LOG = LogManager.getLogger(UAFCryptoModule.class);
 
   public UAFCryptoModule(Properties cryptoProperties) {
     super(cryptoProperties);
 
     if (cryptoProperties == null) {
       String errorMessage = "Module properties object cannot be null.";
       LOG.error(errorMessage);
       throw new UAFRuntimeException(errorMessage);
     }
 
     this.moduleConfigurations.addAll(CryptoConfig.getAllConfigurations());
 
     this.defaultModuleConfigurations.put("uaf.default.external.encryption.transformation", "AES/GCM/NoPadding");
     this.defaultModuleConfigurations.put("uaf.default.external.encryption.key.algo", "AES");
     this.defaultModuleConfigurations.put("uaf.default.external.hmac.key.algo", "HmacSHA256");
     this.defaultModuleConfigurations.put("uaf.crypto.custom.impl.class.name", " ");
 
     this.defaultModuleConfigurations.put("uaf.default.external.encryption.key", " ");
   }
 
   protected void configure()
   {
     super.configure();
 
     bind(Properties.class).annotatedWith(Names.named("uaf.custom.crypto.properties")).toInstance(this.moduleProperties);
 
     bind(CryptoConfig.class).asEagerSingleton();
 
     bind(CryptoEngine.class).asEagerSingleton();
 
     requestStaticInjection(ServerDataAdapter.class);
     requestStaticInjection(CertificateAdapter.class);
   }
 }
